import request from '@/utils/request'
import {getTokenLocalStorage} from "@/utils/utilLocalStorage";

// 登录函数
/**
 * @description: 登录函数
 * @param {*} data { mobile,password}
 * @return {*} promise
 */
export function loginAPI(data) {
  return request({
    // url: '/park/login',
    url: '/auth/login',
    method: 'POST',
    data
  })
}
// 解析token
export function parseToken() {
  return request({
    url: '/auth/userinfo',
    method: 'GET',
    params: {
      token: getTokenLocalStorage()
    }
  })
}
// 教师注册
export function teachersRegisterAPI(data) {
  return request({
    url: '/teachers/register',
    method: 'POST',
    data
  })
}
//学生注册
export function studentsRegisterAPI(data) {
  return request({
    url: '/students/register',
    method: 'POST',
    data
  })
}

/**
 * @description: 头像上传
 * @param {*} data { mobile,password}
 * @return {*} promise
 */
export function uploadAvatarAPI(data) {
  return request({
    url: '/file/upload',
    method: 'POST',
    data
  })
}
